package com.example.mobile203zlw20216061300616;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class main_Adapter extends RecyclerView.Adapter<main_Adapter.adapter_mylist> {
    private List<Student> list;
    OnClickInterface clickInterface;
    interface OnClickInterface{
        public void onclick(View view,int position);
    }
    public void setClickInterface(OnClickInterface clickInterface){
        this.clickInterface=clickInterface;
    }
    public main_Adapter(List<Student> list) {
        this.list = list;
    }
    @NonNull
    @Override
    public adapter_mylist onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new adapter_mylist(LayoutInflater.from(parent.getContext()).inflate(R.layout.main_work,null));
    }

    @Override
    public void onBindViewHolder(@NonNull adapter_mylist holder, int position) {
        Student student=list.get(position);
        holder.name.setText("姓名:"+student.getName());
        holder.skill.setText("技能:"+student.getInformation());
        holder.maney.setText("酬薪:"+student.getManey());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
    public class adapter_mylist extends RecyclerView.ViewHolder {
        private TextView  name, maney,skill;
        public adapter_mylist(@NonNull View itemView) {
            super(itemView);
            name=itemView.findViewById(R.id.tename);
            maney=itemView.findViewById(R.id.temaney);
            skill=itemView.findViewById(R.id.teskill);
        }
    }
}
